package com.mcr.graduateprogram.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcr.graduateprogram.bean.GameSpecification;
import com.mcr.graduateprogram.mapper.GameSpecificationMapper;
import com.mcr.graduateprogram.service.IGameSpecificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author graduateprogram
 * @since 2023-02-25
 */
@Service
public class GameSpecificationServiceImpl extends ServiceImpl<GameSpecificationMapper, GameSpecification> implements IGameSpecificationService {
    @Autowired
    private GameSpecificationMapper gameSpecificationMapper;

    @Override
    public Page<GameSpecification> getPage(Integer page, Integer pageSize, Long gameId) {
        Page<GameSpecification> gameSpecificationPage=new Page<>(page,pageSize);
        LambdaQueryWrapper<GameSpecification> gameSpecificationLambdaQueryWrapper=new LambdaQueryWrapper<>();
        gameSpecificationLambdaQueryWrapper.eq(gameId!=null,GameSpecification::getGameId,gameId);
        gameSpecificationMapper.selectPage(gameSpecificationPage,gameSpecificationLambdaQueryWrapper);
        return gameSpecificationPage;
    }

}
